﻿using System.Globalization;
using System.Numerics;
using System.Windows.Data;

namespace WpfValueConverter
{
    internal class AverageConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is Student student)
            {
                return (student.Chinese + student.Math + student.English + 2) / 3;
            }

            return 0;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
